package cn.com.jcoo;

import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class OpenApiConfig {

	@Bean
	public OpenAPI exampleOpenAPI() {
		// 许可证定义
		License license = new License().name("Apache 2.0").url("http://springdoc.org");

		// 接口信息定义
		Info info = new Info().title("Example API").description("Example for SpringDoc")
				.version("1.0").license(license);

		// // 外部接口文档地址，https://petstore.swagger.io/v2/swagger.json
		// ExternalDocumentation externalDocumentation = new ExternalDocumentation()
		// .description("SpringShop Wiki Documentation")
		// .url("https://springshop.wiki.github.org/docs");

		return new OpenAPI().openapi("3.0.1").info(info)
		// .externalDocs(externalDocumentation)
		;
	}
}
